﻿using System.ComponentModel;
using System.Windows.Forms;
using Medicalsystem.MCP.FormDesigner.Property;

namespace Medicalsystem.MCP.FormDesigner.MyControls
{
    /// <summary>
    /// SingleTextBox 控件与属性编辑器交互
    /// </summary>
    public class GetSingleTextBoxProperty : GetMultiTextBoxProperty
    {
        public GetSingleTextBoxProperty(SingleTextBox singleTxt)
            : base(singleTxt)
        {
            _singleTxt = singleTxt;
        }

        private SingleTextBox _singleTxt = null;

        /// <summary>
        /// 密码字符
        /// </summary>
        [CategoryAttribute("行为")]
        [ShowChinese("密码字符")]
        [Description("获取或设置字符，该字符用于屏蔽控件中的密码字符")]
        public char PasswordChar
        {
            get { return _singleTxt.PasswordChar; }
            set
            {
                this.OnSetPropertyBatch(this, "PasswordChar", value);
            }
        }

        [Browsable(false)]
        public override ScrollBars ScrollBars
        {
            get { return ScrollBars.Both; }
            set { }
        }

        public override void SetProperty(string propertyName, object value)
        {
            switch (propertyName.ToLower())
            {
                case "passwordchar":
                    _singleTxt.PasswordChar = (char)value;
                    break;
                default:
                    base.SetProperty(propertyName, value);
                    break;
            }
        }
    }
}